﻿/*****************************************************************//**
 * @file    FITKGraphObjectLoad_P.h
 * @brief   Graph object for pressure.
 *
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-04-13
 *********************************************************************/

#ifndef __FITKGRAPHOBJECTLOAD_P_H__
#define __FITKGRAPHOBJECTLOAD_P_H__

#include "FITKGraphObjectLoadBase.h"

#include "FITKVTKGraphAdaptorAPI.h"

// Forward declaration
class vtkPolyData;

class FITKGraphActor;

namespace Comp
{
    class FITKGraphRender;
}

namespace Interface
{
    struct AbaEleSurface;
    class FITKModelSet;
    class FITKMeshSurfaceElement;
    class FITKAbstractAssInstance;
    class FITKAbaLoadPressure;
    class FITKAbaMeshPartVTK;
}

namespace Exchange
{
    /**
     * @brief   Graph object for fixed-sized pressure force.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-04-13
     */
    class FITKVTKGRAPHADAPTORAPI FITKGraphObjectLoad_P : public FITKGraphObjectLoadBase
    {
        // Regist
        FITKGraphObjectRegist(FITKGraphObjectLoad_P, FITKGraphObjectLoadBase);
        FITKCLASS(Exchange, FITKGraphObjectLoad_P);

    public:
        /**
         * @brief   Constructor.
         * @param   caseData: The case data
         * @param   pressureData: The pressure data object
         * @param   stepId: The step id
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-13
         */
        FITKGraphObjectLoad_P(AbaqusData::FITKDataCase* caseData, Interface::FITKAbaLoadPressure* pressureData, int stepId);

        /**
         * @brief   Destructor.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-13
         */
        virtual ~FITKGraphObjectLoad_P();

        /**
         * @brief   Update the load actors by current step.[override]
         * @param   forceUpdate: Force update[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-22
         */
        void update(bool forceUpdate = false) override;

        /**
         * @brief   Update the visibility with data object's visibility.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-14
         */
        void updateVisibility() override;

    private:
        /**
         * @brief   Generate load actors with pressure data.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-13
         */
        void generateGraphs();

        /**
         * @brief   Generate the poly data for the pressure load.
         * @param   load: The pressure load data object
         * @return  Is OK
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-25
         */
        bool generatePolyData(Interface::FITKAbaLoadPressure* load);

        /**
         * @brief   Generate load actor.[override]
         * @param   src: The source data
         * @param   size: The actor size ( -1 means use default fixed size )[default]
         * @param   details: Nothing[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-13
         */
        void generateGraph(vtkPolyDataAlgorithm* src, double size = -1., QVariant details = QVariant()) override;

        /**
         * @brief   Initialize the actor's visualization properties.[override]
         * @param   actor: The actor
         * @param   details: Nothing[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-13
         */
        void initActorProperties(vtkProp* actor, QVariant details = QVariant()) override;

        /**
         * @brief   Clear the data.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-24
         */
        void clearData() override;

    };
}   // namespace Exchange

#endif // __FITKGRAPHOBJECTLOAD_P_H__
